Emit catalog events from workflow code - #105
Merged
Merged
Conversation
Most of order's catalog events are decided in workflow code: the saga's failed/compensated outcome, each compensation step, a completion or inventory commit that exhausted its retries. Only the SDK's replay-aware logger may run there, and the facade may not. temporalx.WorkflowEvent writes through workflow.GetLogger, so a replayed history writes nothing; a live run writes the event once, and the replay test proves the code ran. It applies the facade's grammar: an invalid name goes under event.invalid and a caller's own event attribute is renamed.
An invalid event name is now cut the way the facade cuts it: invalid UTF-8 repaired, the cut on a rune boundary, and a truncation marker, so event.invalid reads the same on both paths. The SDK logger skips one more frame, so the record's source is the workflow line that called WorkflowEvent rather than temporalx. The doc states when replay safety holds and how non-standard levels map; the grammar tests pin exact values, including the 64-byte edge and a cut inside a rune.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds
temporalx.WorkflowEvent(ctx workflow.Context, level, name, msg, attrs...)for catalog events decided in workflow code (order's saga outcome, compensation steps, exhausted retries), where only the SDK's replay-aware logger may run.workflow.GetLogger→ replay writes nothing; live run writes once. Test: live=1 / replay=0 with a run counter proving replay executed the code.event.invalid,.conflictrename).Eventcarve-out comment extended.Gate:
make test-temporalx96.0%, lint 0 issues.🤖 Generated with Claude Code
https://claude.ai/code/session_018N7ME8TyWS33cbpWV3v8E8